from building import *

cwd = GetCurrentDir()
CPPPATH = [cwd]

src = []

if GetDepend('SUPPORT_USART_ASM32'):
    if GetDepend('SUPPORT_USART_ASM32F00X'):
        src += Glob('UsartHw_ASM32F00X.c') 
    else:
        src += Glob('UsartDev_ASM32.c') 
elif GetDepend('SUPPORT_USART_ATMEGA'):
    src += Glob('UsartDev_ATMEGA.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_ATMEGA.c') 
elif GetDepend('SUPPORT_USART_HC32'):
    src += Glob('UsartDev_HC32.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_HC32.c') 
    elif GetDepend('SUPPORT_USART_HW_HC32F0X'):
        src += Glob('UsartHw_HC32F0X.c') 
    elif GetDepend('SUPPORT_USART_HW_HC32F00X'):
        src += Glob('UsartHw_HC32F00X.c') 
elif GetDepend('SUPPORT_USART_HC32F4'):
    src += Glob('UsartDev_HC32F4.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_HC32F4x.c') 
elif GetDepend('SUPPORT_USART_LPC_ARM'):
    src += Glob('UsartDev_LPC_Arm.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_LPC_Arm.c') 
elif GetDepend('SUPPORT_USART_MN32F0'):
    src += Glob('UsartDev_MN32F0.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_MN32F0.c') 
elif GetDepend('SUPPORT_USART_STM32'):
    src += Glob('UsartDev_STM32.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_STM32.c') 
elif GetDepend('SUPPORT_USART_STM32G0XX'):
    src += Glob('UsartDev_STM32G0xx.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_STM32.c') 
elif GetDepend('SUPPORT_USART_SWM341'):
    src += Glob('UsartDev_SWM341.c') 
    if GetDepend('SUPPORT_USART_HW'):
        src += Glob('UsartHw_SWM341.c') 
elif GetDepend('SUPPORT_USART_AIC'):
    src += Glob('Usart_AIC.c')  
    if GetDepend('SUPPORT_USART_HW'): 
        src += Glob('UsartHw_AIC.c')                 

if GetDepend('SUPPORT_USART_INSTANCE'):
    src += Glob('Usart.c') 
    if GetDepend('SUPPORT_USART_AIC'):
      src += Glob('UsartDev_AIC.c') 

if GetDepend('SUPPORT_USART_DEV_CFG'):
    src += Glob('UsartDevCfg.c') 
    if GetDepend('SUPPORT_SMENU'):
        src += Glob('UsartDevCfg_SMenu.c') 
    elif GetDepend('SUPPORT_TMENU'):
        src += Glob('UsartDevCfg_TMenu.c') 
    if GetDepend('SUPPORT_USART_DEV_CFG_USER0'):
        if GetDepend('SUPPORT_SMENU'):
            src += Glob('UsartDevCfgU0_SMenu.c') 
        elif GetDepend('SUPPORT_TMENU'):
            src += Glob('UsartDevCfgU0_TMenu.c') 

if GetDepend('SUPPORT_USART_DEV_IO'):
    src += Glob('UsartDevIo.c') 
    src += Glob('UsartHwIo.c') 
    
if GetDepend('SUPPORT_USART_DEV_PT'):
    src += Glob('UsartDevPt.c') 

#增加SUPPORT_EX_PREINCLUDE定义以预包含Preinclude.h
predefine = ['SUPPORT_EX_PREINCLUDE']
group = DefineGroup('usart', src, depend = [''], CPPPATH=CPPPATH, CPPDEFINES = predefine)
Return('group')


